Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VSC-1573] ensure build directories exist and resolve relative paths #1417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

radurentea
Copy link
Collaborator

Description

Fixed an issue where relative paths in project configurations were not being handled correctly and build directories were not being created automatically. The extension now properly resolves relative paths to absolute using the workspace folder as the base and ensures build directories exist before build commands are executed.

Fixes #1408

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Steps to test this pull request

  1. Create a project using example project "multi_config" in esp_idf_project_configuration.json use relative paths for "buildDirectoryPath" property
{
  "prod1": {
    "build": {
      "compileArgs": [],
      "ninjaArgs": [],
      "buildDirectoryPath": "build.prod1",
      "sdkconfigDefaults": [
        "sdkconfig.prod_common",
        "sdkconfig.prod1"
      ],
      "sdkconfigFilePath": ""
    },
    "env": {},
    "flashBaudRate": "",
    "monitorBaudRate": "",
    "openOCD": {
      "debugLevel": 0,
      "configs": [],
      "args": []
    },
    "tasks": {
      "preBuild": "",
      "preFlash": "",
      "postBuild": "",
      "postFlash": ""
    }
  },
  "prod2": {
    "build": {
      "compileArgs": [],
      "ninjaArgs": [],
      "buildDirectoryPath": "build.prod2",
      "sdkconfigDefaults": [
        "sdkconfig.prod_common",
        "sdkconfig.prod2"
      ],
      "sdkconfigFilePath": ""
    },
    "env": {},
    "flashBaudRate": "",
    "monitorBaudRate": "",
    "openOCD": {
      "debugLevel": 0,
      "configs": [],
      "args": []
    },
    "tasks": {
      "preBuild": "",
      "preFlash": "",
      "postBuild": "",
      "postFlash": ""
    }
  }
}
  1. Select either configuration from the ESP-IDF Project Configuration panel
  2. Try to build the project

Expected behaviour:

  • Build directories should be created automatically if they don't exist
  • Build should succeed using the correct paths
  • No errors about missing directories or invalid paths should occur

How has this been tested?

As described above

Test Configuration:

  • ESP-IDF Version: 5.4
  • OS (Windows,Linux and macOS): Windows 11

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

- Replace forEach with Promise.all for proper async handling
- Automatically create build directories using ensureDir
- Convert relative paths to absolute using workspace folder as base
- Refactor build config access for better readability
@radurentea radurentea self-assigned this Jan 30, 2025
Copy link

Download the artifacts for this pull request:
You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select project configuration does not work as expected (VSC-1573)
1 participant